home *** CD-ROM | disk | FTP | other *** search
/ PC Answers 1995 May / PC Answers CD-ROM 7 (Future Publishing) (May 1995).iso / vbits / code / wilmot / topflite / top_gbl.bas < prev    next >
Encoding:
BASIC Source File  |  1994-11-30  |  5.7 KB  |  218 lines

  1. '**********************************************
  2. '* Data structure for Function 99.  This is to
  3. '* hold row and column positions.
  4. '**********************************************
  5. Type RowColPosition
  6.     x As Integer
  7.     Y As Integer
  8. End Type
  9.  
  10. '**********************************************
  11. '*  Data structure for Function 10.  This will
  12. '*  be used by the  array SessionArray.
  13. '**********************************************
  14. Type SessionInfo
  15.     ShortName As String * 1
  16.     LongName As String * 8
  17.     State As String * 1
  18.     PSSize As Integer
  19. End Type
  20.  
  21. Global SessionArray(25) As SessionInfo
  22.  
  23. '************************************************
  24. '*  Data Structure for Function 16.
  25. '************************************************
  26. Type EmulatorControl
  27.     ShortName As String * 1
  28.     Visibility As String * 1
  29.     Reserved As String * 1
  30.     Case As String * 1
  31.     Left As Integer
  32.     Bottom As Integer
  33.     Right As Integer
  34.     Top As Integer
  35. End Type
  36.  
  37. '************************************************
  38. '*  Data Structure for Flight Avalability
  39. '************************************************
  40. Type FAType
  41.  
  42.     Pad1 As String * 1
  43.     Number As String * 2
  44.     Pad2 As String * 2
  45.     Origin As String * 3
  46.     Pad3 As String * 1
  47.     Terminus As String * 3
  48.     Pad4 As String * 3
  49.     LeaveDate As String * 1
  50.     Pad5 As String * 1
  51.     LeaveTime As String * 4
  52.     Pad6 As String * 2
  53.     ArriveDate As String * 1
  54.     Pad7 As String * 1
  55.     ArriveTime As String * 4
  56.     Pad8 As String * 1
  57.     Airline As String * 2
  58.     Pad9 As String * 2
  59.     FlightNumber As String * 3
  60.     Pad10 As String * 1
  61.     Aircraft As String * 3
  62.     Pad11 As String * 1
  63.     Stops As String * 1
  64.     Pad12 As String * 4
  65.     Code1 As String * 18
  66.  
  67. End Type
  68. Global FlightInfo(1 To 100) As FAType
  69. Declare Function ATMGetFlightInfo Lib "ATMAPI.DLL" Alias "ATMGetString" (ByVal hwnd%, ByVal Row%, ByVal Column%, FlightInfoString As Any, ByVal Length%) As Integer
  70.  
  71.  
  72. Type ExtraCodesType
  73.     Pad1 As String * 49
  74.     Code1 As String * 9
  75. End Type
  76. Global ExtraCodes(1 To 100) As ExtraCodesType
  77.  
  78. '*************************************************
  79. '*  Declare a global variable to contain the
  80. '*  window handle information for the current form.
  81. '*  This will require some programming by the user.
  82. '*************************************************
  83. Global hCom As Integer
  84.  
  85. Global PSID$
  86.  
  87. ' BackColor, ForeColor, FillColor (standard RGB colors: form, controls)
  88. Global Const BLACK = &H0&
  89. Global Const RED = &HFF&
  90. Global Const GREEN = &HFF00&
  91. Global Const YELLOW = &HFFFF&
  92. Global Const BLUE = &HFF0000
  93. Global Const MAGENTA = &HFF00FF
  94. Global Const CYAN = &HFFFF00
  95. Global Const WHITE = &HFFFFFF
  96.  
  97. Global Path$
  98. Global FileName$
  99. Global LoadFile$
  100. Global NewName$
  101. Global Length%
  102. Global PauseTime%
  103. Global pndrow%
  104. Global pndcol%
  105. Global inactrow%
  106. Global inactcol%
  107. Global nccflog$
  108. Global statlog$
  109. Global nccfkey$
  110. Global HostSession$
  111. Global Retry$
  112. Global Title$
  113. Global NetVID$
  114. Global StatMainID$
  115. Global StatDetailID$
  116. Global NccfID$
  117. Global AvailCom As String
  118. Global CurrentDay As String
  119. Global fLoggedOn As Integer
  120. Global NumbFlights As Integer
  121.  
  122.  
  123.  
  124. Global PU()  As String
  125. Global SideA() As String
  126. Global SideB() As String
  127. Global Pending() As String
  128. Global Inactive() As String
  129.  
  130. Sub CenterForm (FormToCenter As Form)
  131.     FormToCenter.Left = (Screen.Width - FormToCenter.Width) / 2
  132.     FormToCenter.Top = (Screen.Height - FormToCenter.Height) / 2
  133. End Sub
  134.  
  135. Sub GetFlightAvailability (AvailCom As String)
  136.  
  137.     Dim sHold As FAType
  138.     Dim sxHold As ExtraCodesType
  139.     Dim MoreIndicator As String
  140.     Dim fGotExtraCodes As Integer
  141.     Dim fAnotherPage As Integer
  142.  
  143.     If Not fLoggedOn Then
  144.         'DoLoggonProcess
  145.     End If
  146.  
  147.     NumbFlights = 0
  148.     fAnotherPage = True
  149.     fGotExtraCodes = True
  150.     retc% = ATMSendKey(hCom, AvailCom + "@E")
  151.     retc% = ATMWaitHostQuiet(hCom, 250, 4)
  152.  
  153.  
  154.     Do While fAnotherPage
  155.  
  156.         For i% = 2 To 19
  157.             x% = ATMGetFlightInfo(hCom, i%, 1, sHold, Len(sHold))
  158.             
  159.             If Val(sHold.Number) > 0 Then
  160.                 If sHold.Airline = "SA" Then
  161.                     NumbFlights = NumbFlights + 1
  162.                     fGotExtraCodes = False
  163.                     FlightInfo(NumbFlights) = sHold
  164.                     Debug.Print NumbFlights, FlightInfo(NumbFlights).FlightNumber
  165.                 End If
  166.             Else
  167.                 If Not fGotExtraCodes Then
  168.                     x% = ATMGetFlightInfo(hCom, i%, 1, ExtraCodes(NumbFlights), Len(sxHold))
  169.                     fGotExtraCodes = True
  170.                     Debug.Print "             ExtraCodes", NumbFlights, ExtraCodes(NumbFlights).Code1
  171.                 End If
  172.     
  173.             End If
  174.             
  175.         Next i%
  176.  
  177.         x% = ATMGetString(hCom, 21, 2, MoreIndicator, 5)
  178.         If UCase$(Left(MoreIndicator, 1)) = "M" Then
  179.             fAnotherPage = True
  180.             retc% = ATMSetCursorLocation(hCom, 22, 2)
  181.             retc% = ATMSendKey(hCom, "md@E")
  182.             retc% = ATMWaitHostQuiet(hCom, 250, 4)
  183.         Else
  184.             fAnotherPage = False
  185.         End If
  186.             
  187.     Loop
  188.  
  189.     retc% = ATMSetCursorLocation(hCom, 22, 2)
  190.     retc% = ATMSendKey(hCom, "mu@E")
  191.     retc% = ATMWaitHostQuiet(hCom, 250, 4)
  192.  
  193. End Sub
  194.  
  195. Function TranslateAircraft (AircraftCode As String) As String
  196.     
  197.     Select Case AircraftCode
  198.  
  199.         Case "AB3"
  200.             TranslateAircraft = "Airbus 300"
  201.  
  202.         Case "320"
  203.             TranslateAircraft = "Airbus 320"
  204.  
  205.         Case "73S"
  206.             TranslateAircraft = "Boeing 737"
  207.  
  208.         Case "F28"
  209.             TranslateAircraft = "Fokker 28"
  210.  
  211.         Case Else
  212.             TranslateAircraft = "Unknown"
  213.  
  214.     End Select
  215.  
  216. End Function
  217.  
  218.